<?php

/**
 * 管理后台->区域服务
 *
 * /Apps/Backend/Controller/AreaController.class.php
 *
 * Zix @ 2015-06-11
 */
namespace Backend\Controller;

use Common\Service\AreaService;

class AreaController extends BackendController {
	public function index() {
	}
  
	function get_default() {
    $Area = AreaService::instance();
    $data = $Area->get_default();
    $this->ajaxReturn($data);
	}
  
	function get_by_pid( $pid ) {
    $Area = AreaService::instance();
    $ret['data'] = $Area->get_by_pid($pid);
    
    $ret['default'] = 0 ;
    if ( !empty( $ret['data'] ) ) {
      $ret['default_id'] = $ret['data'][0]['id'] ;
    }
    $this->ajaxReturn($ret);
	}
    
	function get_by_district( $district_id ) {
    $Area = AreaService::instance();
    $data = $Area->get_by_district($district_id);
    $this->ajaxReturn($data);
	}

}
